#include <iostream>
#include <vector>

using namespace std;

void huishuo(vector<int>& left,vector<int>& used){
    if(left.size()==0){
        for(int i=0;i<used.size();i++){
            cout<<used[i]<<" ";
        }
        cout<<endl;
        return;
    }
    for(int i=0;i<left.size();i++){
        int tmp=left[i];
        left.erase(left.begin()+i);
        used.push_back(tmp);
        huishuo(left,used);
        left.insert(left.begin()+i,tmp);
        used.pop_back();
    }
}

int main(){
    vector<int> left{1,2,3};
    vector<int> used;
    huishuo(left,used);
}